/*********************************
* John Clayton
* Assignment 3
* CS362
* Outpost test
*********************************/

#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <math.h>

#define NUM_TESTS 10 //Number of times to run the test

int main(){
   int i, j, k, player, numPlayers, handPos, opt1, opt2, opt3,
       bonus = 1, numOutposts;
   int* kCards;
   struct gameState *state;
   enum CARD card = outpost;
   enum CARD firstCard = curse;
   enum CARD lastCard = treasure_map;
   PlantSeeds(3);
   SelectStream(0);
   assert(state != 0);

   printf("Beginning testing card: outpost\n**************************************\n");
   for(i = 0; i <= NUM_TESTS; i++){
      state = newGame();
      numPlayers = (((int) (Random() * 1000))%4) + 1;
      kCards = kingdomCards((int) (Random() * 256) % (lastCard - firstCard) + firstCard,
	    (int) (Random() * 256) % (lastCard - firstCard) + firstCard,
	    (int) (Random() * 256) % (lastCard - firstCard) + firstCard,
	    (int) (Random() * 256) % (lastCard - firstCard) + firstCard,
	    (int) (Random() * 256) % (lastCard - firstCard) + firstCard,
	    (int) (Random() * 256) % (lastCard - firstCard) + firstCard,
	    (int) (Random() * 256) % (lastCard - firstCard) + firstCard,
	    (int) (Random() * 256) % (lastCard - firstCard) + firstCard,
	    (int) (Random() * 256) % (lastCard - firstCard) + firstCard,
	    (int) (Random() * 256) % (lastCard - firstCard) + firstCard);
      initializeGame(numPlayers, kCards,(int) (Random()*256), state);
      player = state->whoseTurn;
      state->outpostPlayed = (int) (Random() * 256) % 10;
      handPos = 0;
      numOutposts = state->outpostPlayed;
      opt1 = (int) (Random() * 256) % (lastCard - firstCard) + firstCard;
      opt2 = (int) (Random() * 256) % (lastCard - firstCard) + firstCard;
      opt3 = (int) (Random() * 256) % (lastCard - firstCard) + firstCard;
      cardEffect(card, opt1, opt2, opt3, state, handPos, &bonus);
      if(state->outpostPlayed != numOutposts + 1)
	 printf("[Test %d]The number of outposts was not update. (should have: %d, has: %d)\n", i, numOutposts + 1, state->outpostPlayed);
   }
   printf("Ending testing card: outpost\n***********************************\n");
   return 0;
}